package com.company.factory;

import com.company.pojo.Pizza;
import com.company.pojo.concrete.CheesePizza;
import com.company.pojo.concrete.ClamPizza;
import com.company.pojo.concrete.VeggiePizza;

/**
 * 简单工厂：小作坊模式
 */
public class SimplePizzaFactory {
    public Pizza createPizza(String type) {
        Pizza pizza = null;

        if("cheese".equals(type)) {
            pizza = new CheesePizza();
        } else if("clam".equals(type)) {
            pizza = new ClamPizza();
        } else if("veggie".equals(type)) {
            pizza = new VeggiePizza();
        }

        return pizza;
    }
}
